package com.scau.XFourPOS.action;

import javax.annotation.Resource;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;

import com.scau.XFourPOS.model.Customer;
import com.scau.XFourPOS.model.Product;
import com.scau.XFourPOS.service.CustomerService;
import com.scau.XFourPOS.utils.PageUtils;

public class CustomerAction {
	private Customer customer;
	
	
	
	@Resource
	CustomerService customerService;
	
	
	@Action(value = "productAction", results = {
			@Result(name = "success", location = "/yes.jsp")})
	
	
	
	//增加用户
	public String saveCustomerAction(){
		customerService.saveOrUpdateEntity(customer);;
		return "success";
	}
	
	//删除用户
	public String deleteCustomerAction(Customer customer){
		customerService.deleteEntity(customer);
		return "success";
	}
	
	public String deleteCustomerByIdAction(int id){
		customerService.deleteEntityById(id);
		return "success";
	}
	
	
	//查询用户
	public String searchCustomerAction(int id){
		customerService.loadEntityById(id);
		return "success";
	}
	
	
	//更新用户信息
	public String updateCusteomerAcrion() {
		customerService.saveOrUpdateEntity(customer);
		return "success";
	}
}
